#!/usr/bin/python3
# -*- coding: UTF-8 -*-


from rich import print
from auto_report.utils import info, print_map
# from auto_report.auto_report import AutoReport
from auto_report.lake_report import LakeReport
from auto_report.not_lake_report import NotLakeReport
from auto_report.zhuanzhai_report import ZhuanZhaiReport
from auto_report.hupogeming_report import HuPoGeMingReport

TEMPLATE_MAP = {
    0: '资环处中央预算内月报表',
    1: '地区处九湖月报表',
    2: '地区处非九湖月报表',
    3: '地区处专债月报表',
    4: '湖泊革命报表',
}


ACTION_MAP = {
    0: '合并',
    1: '拆分',
}


def main():


    # target_month = '2021-09'

    # report = None
    # report = HuPoGeMingReport(target_month)

    # report.statistic()

    # quit()

    print('输入两位参数 [bold green]<模板号><操作号>[/bold green]')

    print_map(TEMPLATE_MAP, '模板：')
    print_map(ACTION_MAP, '操作：')

    args = input('$ ')

    [tem, act] = args
    TEMPLATE = int(tem)
    ACTION = int(act)
    info('args', TEMPLATE, ACTION)

    print('''输入目标月份：
    年月中间用中杠分隔，格式为 [bold green]<2020-03>[/bold green]''')

    target_month = input('$ ')


    if TEMPLATE == 1:
        report = LakeReport(target_month)
    if TEMPLATE == 2:
        report = NotLakeReport(target_month)
    if TEMPLATE == 3:
        report = ZhuanZhaiReport(target_month)
    if TEMPLATE == 4:
        report = HuPoGeMingReport(target_month)


    if ACTION == 0:
        report.generate()
    if ACTION == 1:
        report.split()
    # report = AutoReport(target_month)
    # mf = report.get_month_field()
    # print('目标月份', mf)
    # lmf = report.get_last_month_field()
    # print('上一个月份', lmf)
    # report.get_files('jiuhu/2021-06')



if __name__ == '__main__':
    main()